﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<QianBuo.Lottery.Web.Models.Play.PlayTypeModel>" %>
<div >
    <div id="play_inputpanel">
        <table border="0" cellpadding="0" cellspacing="5" class="play_play_input">
<%--            <tr id="input_model">
                <td>
                   &nbsp; 
                </td>
            </tr>--%>
            <tr class="tr_number" id='input_0'>
                <td colspan='2' id="tdNums"></td>
            </tr>
            <tr id="playinfo">
                <td colspan="2" style="text-align:left">
                    <%=Model.Remark %>
                </td>
            </tr>
            <tr>
                <td id="sumcount">
                    注数:<font color="red">0</font>
                </td>
                <td align="left">
                    <input type="button" name="bet_play_btnadd" onclick="AddScheme_HC()" id="bet_play_btnadd" value="添加" class="bet_play_btnadd" />
                </td>
            </tr>
        </table>
    
        <script type="text/javascript">

         var __playid=<%=Model.PlayID %>;
            $(document).ready(showWinInfo);
            function showWinInfo(){
                var pwin = Site.Lottery.Bet.GetPlayTypeWinMoney(function(item){ return item.PlayTypeID == __playid;});
                if(pwin != null)
                    $('<span><%=string.IsNullOrEmpty(Model.Remark) ? "" : "，" %>'+"奖金:<font color='red'>"+pwin.WinMoney+"元</font></span>").appendTo($("#playinfo td"));
                else
                    window.setTimeout(showWinInfo,500);
            }
            var playType_obj=<%=ViewData["playType_obj"]??null %>;
            if(playType_obj==null){
                window.history.go(-1);
                alert('访问出错!');
            }
            playType_obj.PlayTypeName='<%=Model.Name%>';
            playType_obj.PlayTypeID=<%=Model.ID %>;
            
            Site.Lottery.Bet.SetCurrentPlay(playType_obj.PlayTypeID, playType_obj.PlayTypeName);
            
            $("#tdNums").append(playType_InputPanal);

            $(".play_play_input .num").click(function () {
                var item = $(this);
                if (item.is(".select1")) {
                    item.removeClass("select1");
                    playType_obj.RemoveChoseNums(this.id);
                }
                else {
                    item.addClass("select1");
                    playType_obj.AddChoseNums(this.id);
                }

                //alert(QianSanZhiXuan.ChooseNumber['p10000'].length+','+QianSanZhiXuan.ChooseNumber['p1000'].length+','+QianSanZhiXuan.ChooseNumber['p100'].length);

                var count = playType_obj.GetNumsCount();

                $(".play_play_input #sumcount font").html(count);
            });

            $(".play_play_input .tool").click(function () {
                SelectNumber(playType_obj,$(this).parent().find(".num"), this.innerText);
            });

 function SelectNumber(obj, numbers, type) {
    numbers.each(function () {
     
        obj.RemoveChoseNums(this.id);
        $(this).removeClass("select1");
    });
    $(".play_play_input #sumcount font").html('0');
    switch (type) {
        case "全":
            numbers.click();
            break;
        case "大":
            numbers.each(function () {
                var v=parseInt(this.innerText)%12;
                if ( v>6||v==0){
                    $(this).click();
                }
            });
            break;
        case "小":
            numbers.each(function () {
                var v=parseInt(this.innerText)%12;
                if (v<7&&v>0)
                    $(this).click();
            });
            break;
        case "奇":
            numbers.each(function () {
                if (parseInt(this.innerText) % 2 == 1)
                    $(this).click();
            });
            break;
        case "偶":
            numbers.each(function () {
                if (parseInt(this.innerText) % 2 == 0)
                    $(this).click();
            });
            break;
        case "清":
            var count = obj.GetNumsCount();
            $(".play_play_input #sumcount font").html(count);
            break;
    }

}

 function AddScheme_HC() {
 var obj=playType_obj;
    var number = obj.ChoseNums.split(',').sort().join(',');
    var count = obj.GetNumsCount();
    if(count==0){
        alert("选择的号码不正确");
        return ;
    }
    if (Site.Lottery.Bet)
        Site.Lottery.Bet.AddPlayItem(obj.PlayTypeID, obj.PlayTypeName, number, count, 1);
    obj.ChoseNums = '';
    $(".play_play_input #sumcount font").html('0');
    $(".play_play_input .number1").each(function (){
        $(this).removeClass('select1');
    });
}
        </script>
    </div>
</div>
<style type="text/css">
.play_play_input .head {
font-size: 12px;
font-weight: bold;
width: 40px;
}
</style>


